<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">


<p:dialog id="dialogCadastro" modal="true" width="60%" appendTo="@(body)" position="top"
	widgetVar="dialogCadastroRaca" header="Cadastro de Raça" resizable="true" draggable="true">
	<p:ajax event="close" listener="#{racaMB.close}" update="frmDialogRaca" />
	<h:form id="frmDialogRaca">

		<h:panelGrid columns="2">

			<p:outputLabel value="Codigo:"></p:outputLabel>
			<p:inputText value="#{racaMB.racaSelecionada.codigo}" disabled="true"></p:inputText>

			<p:outputLabel value="Descrição:" for="iptdesc"></p:outputLabel>
			<p:inputText id="iptdesc" onfocus="iptdesc"
				value="#{racaMB.racaSelecionada.descricao}" size="30"
				disabled="#{racaMB.consultando}" required="true"
				requiredMessage="Descrição é obrigatória!" maxlength="40"></p:inputText>

			<p:outputLabel value="Tipo Animal:" for="selecttipo"></p:outputLabel>
			<p:selectOneMenu value="#{racaMB.racaSelecionada.tipoAnimal}"
				required="true" id="selecttipo" disabled="#{racaMB.consultando}"
				converter="tipoAnimalConverter">
				<f:selectItems value="#{racaMB.listaTipoAnimal}" var="tipo"
					itemLabel="#{tipo.descricao}" itemValue="#{tipo}"></f:selectItems>
			</p:selectOneMenu>

			<p:outputLabel value="Porte:" for="selectporte"></p:outputLabel>
			<p:selectOneMenu value="#{racaMB.racaSelecionada.porte}" 
				required="true" id="selectporte" disabled="#{racaMB.consultando}">
				<f:selectItems value="#{racaMB.listaPorte}" var="port"
					itemLabel="#{port.descricao}" itemValue="#{port.id}"></f:selectItems>
			</p:selectOneMenu>
		</h:panelGrid>
		<h:panelGrid columns="2" style="border:0px">
			<p:commandButton value="Confirma" actionListener="#{racaMB.salvar}"
				rendered="#{not racaMB.consultando}"
				update="frmDialogRaca,:frmTab:tabela,:mensagem"
				oncomplete="validaDialog(args,'dialogCadastroRaca','frmDialogRaca:dialogCadastro')" />


			<p:commandButton id="btnFechar" value="Cancela" onclick="dialogCadastroRaca.hide()" immediate="true"/>

		</h:panelGrid>

	</h:form>
</p:dialog>

</html>